|
|
![]() | |
|
|
|
To access the contents, click the chapter and section titles.
Fast Track Visual C++ 6.0 Programming
Listing 11.3 LaunchView.h and LaunchView.cpp
// LaunchView.h : interface of the CLaunchView class
//
/////////////////////////////////////////////////////////////////////////////
#if
!defined(AFX_LAUNCHVIEW_H__A45E4A3F_A79A_11D1_887F_D
42B07C10710__INCLUDED_)
#define AFX_LAUNCHVIEW_H__A45E4A3F_A79A_11D1_887F_D
42B07C10710__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CLaunchView : public CView
{
protected: // create from serialization only
CLaunchView();
DECLARE_DYNCREATE(CLaunchView)
// Attributes
public:
CLaunchDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLaunchView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CLaunchView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CLaunchView)
afx_msg void OnFileInstalllauncher();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in LaunchView.cpp
inline CLaunchDoc* CLaunchView::GetDocument()
{ return (CLaunchDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional
declarations immediately before the previous line.
#endif // !defined(AFX_LAUNCHVIEW_H__A45E4A3F_A79A_11D1_887F_D
42B07C10710__INCLUDED_)
// LaunchView.cpp : implementation of the CLaunchView class
//
#include stdafx.h
#include Launch.h
#include LaunchDLL.h
#include LaunchDoc.h
#include LaunchView.h
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLaunchView
IMPLEMENT_DYNCREATE(CLaunchView, CView)
BEGIN_MESSAGE_MAP(CLaunchView, CView)
//{{AFX_MSG_MAP(CLaunchView)
ON_COMMAND(ID_FILE_INSTALLLAUNCHER, OnFileInstalllauncher)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLaunchView construction/destruction
CLaunchView::CLaunchView()
{
// TODO: add construction code here
}
CLaunchView::~CLaunchView()
{
}
BOOL CLaunchView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CLaunchView drawing
void CLaunchView::OnDraw(CDC* pDC)
{
CLaunchDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CLaunchView printing
BOOL CLaunchView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CLaunchView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CLaunchView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CLaunchView diagnostics
#ifdef _DEBUG
void CLaunchView::AssertValid() const
{
CView::AssertValid();
}
void CLaunchView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CLaunchDoc* CLaunchView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLaunchDoc)));
return (CLaunchDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CLaunchView message handlers
void CLaunchView::OnFileInstalllauncher()
{
// TODO: Add your command handler code here
InstallLauncher();
}
Whats AheadIn the next chapter, we turn to another powerful aspect of Windows programming: using COM and OLE. These subjects are very popular with programmers, and were going to put them to work for us next.
|
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |